<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>我的</title>
    <link href="../css.min/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="../css/common.css" />
    <style>
    	.userBar{
    		background-image: url(../img/background.jpg);
    	}
    	.userBarHeight{
    		height: 100px;
    		line-height: 100px;
    	}
    	.mui-content>.mui-table-view:first-child{
    		margin-top: 0px;
    	}
    </style>
</head>
<body>
	<div class="mui-content">
		<div id="modal" class="mui-modal">
			<div class="mui-content" style="height: 100%;padding: 5px;">
				<textarea id="textarea" rows="7" placeholder="~您想对我说些什么~"></textarea>
				<a class="mui-btn mui-btn-outlined mui-btn-red" href="#modal">提交</a>
				<a class="mui-btn mui-btn-outlined mui-btn-red" href="#modal">返回</a>
			</div>
		</div>
		
		<ul class="mui-table-view mui-table-view-chevron userBar userBarHeight">
			<li class="mui-table-view-cell mui-media mui-disabled">
				<a id="user-login" class="mui-navigate-right userBarHeight">
					<img class="mui-media-object mui-pull-left" style="margin-top: 18px;" src="../img/user.png">
					<h4 id="user-name" style="margin-top: 30px;color: white;">未登录</h4>
				</a>
			</li>
		</ul>
		
		<ul class="mui-table-view mui-table-view-chevron" style="margin-top: 20px;">
			<li class="mui-table-view-cell mui-media">
				<a id="manage-address" class="mui-navigate-right">
					<img class="mui-media-object mui-pull-left" src="../img/guanlidizhi.png">
					<span class="mui-media-object">地址管理</span>
				</a>
			</li>
			<li class="mui-table-view-cell mui-media">
				<a id="about-us" class="mui-navigate-right">
					<img class="mui-media-object mui-pull-left" src="../img/guanyuwomen.png">
					<span class="mui-media-object">关于我们</span>
				</a>
			</li>
			<li class="mui-table-view-cell mui-media">
				<a href="#modal" class="mui-navigate-right">
					<img class="mui-media-object mui-pull-left" src="../img/yijianfankui.png">
					<span class="mui-media-object">意见反馈</span>
				</a>
			</li>
		</ul>
		
		<ul class="mui-table-view" style="margin-top: 50px;">
			<li class="mui-table-view-cell" style="text-align: center;">
				<a id='exit' style="color: #EE4B62;">安全退出</a>
			</li>
		</ul>
		
		<p style="margin-top: 20px;">~体验账户：丰丰，ff123~</p>
		
	</div>
</body>
<script src="../js.min/mui.min.js"></script>
<script type="text/javascript" src="../js/config.js" ></script>
<script type="text/javascript" src="../js/utils.js" ></script>
<script type="text/javascript" src="../js/cache.js" ></script>
<script type="text/javascript" charset="utf-8">
    mui.init();
    
    var UserLoginLink=null,UserNameLable=null,ManageAddressLink=null,
    AboutLink=null,ExitLink=null;
    document.addEventListener("DOMContentLoaded",function(){
    	UserLoginLink=document.getElementById("user-login");
    	UserNameLable=document.getElementById("user-name");
    	ManageAddressLink=document.getElementById("manage-address");
    	AboutLink=document.getElementById("about-us");
    	ExitLink=document.getElementById("exit");
    	
    	UserLoginLink.addEventListener('tap',function(){
    		//if(CACHE.Login()=="true") return;
    		utils.openWindow("login","login.html","slide-in-right",300,false);
    	});
    	
    	//地址管理
    	ManageAddressLink.addEventListener('tap',function(){
    		if(CACHE.Login()=="true"){
    			utils.openWindow("add_address","add_address.html",
    			"slide-in-right",300,false);
    		}else{
    			utils.openWindow("login","login.html","slide-in-right",300,false);
    		}
    		
    	});
    	
    	//关于我们
    	AboutLink.addEventListener('tap',function(){
    		plus.runtime.getProperty(plus.runtime.appid,function(inf){
    			mui.alert("当前版本-V"+inf.version);
    		});
    		
    	});
    	
    	//安全退出
    	ExitLink.addEventListener('tap',function(){
    		if(CACHE.Login()=="true"){
    			CACHE.Login('');
	    		CACHE.UserName('');
	    		
	    		UserNameLable.innerHTML="未登录";
	    		//可能刷新订单中心webview
	    		var orderView=plus.webview.getWebviewById("pages/order.html");
	    		if(orderView) mui.fire(orderView,"RefreshPage");
	    		
	    		mui.toast("~轻轻的，您走了~");
    		}
    		
    	});
    	
    },false);
    
    /**
     * h5+ ready
     */
    mui.plusReady(function(){
    	//login exist
    	if(CACHE.Login()=="true"){
    		UserNameLable.innerHTML=CACHE.UserName()||"未登录";
    	}
    });
    
    /**
     * 有登录需求的需实现该监听
     */
    window.addEventListener("RefreshPage",function(e){
    	if(CACHE.Login()=="true"){
    		UserNameLable.innerHTML=CACHE.UserName()||"未登录";
    	}
    });
    
</script>
</html>